Skip to content

test: Cover the docker credential stripping in pushManifestV3 - #1417

Open
ZPascal wants to merge 2 commits into
cloudfoundry:5.x.xfrom
ZPascal:followup-strip-docker-credentials-tests
Open

ZPascal wants to merge 2 commits into
cloudfoundry:5.x.xfrom
ZPascal:followup-strip-docker-credentials-tests

Conversation

@ZPascal

@ZPascal ZPascal commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #1410. These points came up in review and were moved out of that PR so it didn't have to wait for them.

  • Add a DefaultApplicationsTest case for pushManifestV3. It captures both requests and checks that the apply_manifest body has the image but no username or password, while the CreatePackageRequest still gets all three. Before this, nothing tested the fix itself, only the static helper.
  • Move the stripDockerCredentials test from ApplicationManifestUtilsV3Test to DefaultApplicationsTest. It now covers three apps: a private docker app (credentials removed, other fields kept), a public docker app and a buildpack app (both returned unchanged).
  • stripDockerCredentials now leaves an app alone only when username and password are both missing. Today the manifest validation requires both together, so this changes nothing yet. It stops a username from slipping through if that check is ever relaxed.
  • ApplicationManifestUtilsV3Test now deletes its temp manifest files. Before, every run left test-manifest-*.yml files with password: secret in the temp dir.

Test plan

  • DefaultApplicationsTest and ApplicationManifestUtilsV3Test pass (129 tests)
  • spotless:check passes
  • With the unstripped manifest sent to apply_manifest, the new push test fails
  • CI is green

@ZPascal
ZPascal force-pushed the followup-strip-docker-credentials-tests branch from 5c7aee3 to 5584a03 Compare November 24, 2026 17:18
Follow-up to cloudfoundry#1410:
- Add a DefaultApplicationsTest case for pushManifestV3 that checks the
  apply_manifest body has no docker credentials while the package request
  still gets them.
- Move the stripDockerCredentials test to DefaultApplicationsTest and cover
  several apps, untouched apps and kept fields.
- Only skip stripping when both username and password are missing.
- Delete the temp manifest files written by ApplicationManifestUtilsV3Test.
- Remove the stripDockerCredentials assertion on the original manifest.
  ManifestV3 is immutable, so it could never fail, and the push test
  already checks that createPackage gets the credentials.
- Move the two new tests to their alphabetical place in
  DefaultApplicationsTest.
@ZPascal
ZPascal force-pushed the followup-strip-docker-credentials-tests branch from 5584a03 to f6d72f1 Compare November 24, 2026 18:15

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant